package com.surveillance.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name = "examen", uniqueConstraints = { @UniqueConstraint(columnNames = { "id" }) })
public class Examen extends BaseEntity {
	
	@Column(name = "DATE_DBUT")
	private Date dateDebut;
	@Column(name = "DATE_FIN")
	private Date dateFin;
	@OneToMany(fetch = FetchType.EAGER, targetEntity = Salle.class)
	private Set<Salle> salles = new HashSet<Salle>(0);
	@ManyToOne(fetch = FetchType.EAGER, targetEntity = Agenda.class)
	private Agenda agenda;
	@OneToMany(fetch = FetchType.EAGER, targetEntity = Surveillant.class)
	private Set<Surveillant> surveillants = new HashSet<Surveillant>(0);
	@OneToOne(fetch = FetchType.EAGER, targetEntity = Matiere.class)
	private Matiere matiere;

	public Examen() {

	}
	
	public Examen(Date dateDebut, Date dateFin, Set<Salle> salles,
			Agenda agenda, Set<Surveillant> surveillants, Matiere matiere) {
		super();
		this.dateDebut = dateDebut;
		this.dateFin = dateFin;
		this.salles = salles;
		this.agenda = agenda;
		this.surveillants = surveillants;
		this.matiere = matiere;
	}

	public Date getDateDebut() {
		return dateDebut;
	}

	public void setDateDebut(Date dateDebut) {
		this.dateDebut = dateDebut;
	}

	public Date getDateFin() {
		return dateFin;
	}

	public void setDateFin(Date dateFin) {
		this.dateFin = dateFin;
	}

	public Agenda getAgenda() {
		return agenda;
	}

	public void setAgenda(Agenda agenda) {
		this.agenda = agenda;
	}

	public Set<Surveillant> getSurveillants() {
		return surveillants;
	}

	public void setSurveillants(Set<Surveillant> surveillants) {
		this.surveillants = surveillants;
	}

	public Set<Salle> getSalles() {
		return salles;
	}

	public void setSalles(Set<Salle> salles) {
		this.salles = salles;
	}

	public Matiere getMatiere() {
		return matiere;
	}

	public void setMatiere(Matiere matiere) {
		this.matiere = matiere;
	}





	@Override
	public String toString() {
		return "Examen [dateDebut=" + dateDebut + ", dateFin=" + dateFin
				+ ", salles=" + salles + ", agenda=" + agenda
				+ ", surveillants=" + surveillants + ", matiere=" + matiere
				+ "]";
	}
	
}
